[WIP] Make ImageFiltering.imfilter pipeline differentiable#21
[WIP] Make ImageFiltering.imfilter pipeline differentiable#21
ImageFiltering.imfilter pipeline differentiable#21Conversation
Codecov Report
@@ Coverage Diff @@
## main #21 +/- ##
===========================================
- Coverage 88.23% 55.55% -32.68%
===========================================
Files 3 4 +1
Lines 102 162 +60
===========================================
Hits 90 90
- Misses 12 72 +60
Continue to review full report at Codecov.
|
|
Yeah you definitely want the Tangent to wrap an array and not elements I would imagine. |
DhairyaLGandhi
left a comment
There was a problem hiding this comment.
Thanks for taking this up! Looking forward to the tests. I'll also take a look through the adjoints to see if they're correct
| z) | ||
| y = __imfilter_inbounds!(r, out, A, kern, border, R, z) | ||
| function ∇__imfilter_inbounds!(Δy) | ||
| # ∇out should not have any gradients |
There was a problem hiding this comment.
Since it will be used further down in the computation pipeline, i think you still need to provide it the gradient so it can be accumulated properly. Else the answer would be incorrect
| y = imfilter!(out, img, kernel, border, alg) | ||
| function ∇imfilter!_try(Δy) | ||
| k = default_resource(alg_defaults(alg, out, kernel)) | ||
| ret = imfilter!(k, out, img, kernel, border) |
There was a problem hiding this comment.
Is this true generically?
This PR aims to make the
ImageFiltering.imfilterfunction differentiable.The current issue I am facing causes the gradient of the kernel to be
nothing. There seems to be a place where I have incorrectly put aNoTangent(), or a@nograd. Infact upon some further tracing I found out it does go inside the rule of__imfilter_inbounds!, but never calls the pullback inside it.The
imggradient is incorrect too, and I shall get it rectified when I write tests and figure out the kernel thing.